package gl.android.biyiqing.fragment;

import gl.android.biyiqing.R;
import gl.android.biyiqing.competent.OnGreeItemClickListener;
import gl.android.biyiqing.competent.TabViewPager;
import gl.common.UserManger;

import java.util.ArrayList;

import org.json.JSONException;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RadioGroup;

/**
 * 消息盒子
 * 
 * @author geliang
 * 
 */
public class MessageBoxFragment extends BaseListFragmet implements
		OnClickListener {

	private RadioGroup mRadioGroup;
	private ViewPager pager;

	private void bindViews() {

		mRadioGroup = (RadioGroup) rootView.findViewById(R.id.RadioGroup);
		pager = (android.support.v4.view.ViewPager) rootView
				.findViewById(R.id.pager);
	}

	public MessageBoxFragment() {
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		rootView = inflater.inflate(R.layout.fragment_messagebox, container,
				false);
		bindViews();
		ArrayList<Fragment> fragments = new ArrayList<Fragment>();
		for (int i = 0; i < mRadioGroup.getChildCount(); i++) {
			fragments.add(MessageListFragment.creatBaseFramgent(
					String.valueOf(i), MessageListFragment.class));
		}
		new TabViewPager(this, pager, mRadioGroup, fragments);
		return rootView;
	}


	@Override
	public Object getOnItemListener(String[] from, String t)
			throws JSONException {
		return new OnGreeItemClickListener(t, getArguments().getString(
				KEY_TO_USER_ID));
	}

	@Override
	public void onClick(View v) {
		
	}
}